function div = gmm_kl_variational(f, g)

% not quite working

div = 0;
for i = 1:f.ncentres
    num = 0;
    for j = 1:f.ncentres
        num = num + f.priors(j)*exp(-gausskl(f.centres(i, :), f.covars(:, :, i), f.centres(j, :), f.covars(:, :, j)));
    end

    den = 0;
    for j = 1:g.ncentres
        den = den + g.priors(j)*exp(-gausskl(f.centres(i, :), f.covars(:, :, i), g.centres(j, :), g.covars(:, :, j)));
    end

    div = div + f.priors(i)*(log(num+realmin)-log(den+realmin));
end
